import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../components/Login.vue'
import Home from '../components/Home.vue'
import Welcome from '../components/Welcome.vue'
import UserManagement from '../components/UserManagement.vue'
import HotelPersomManagement from '../components/HotelPersomManagement.vue'
import Users from '../components/user/Users.vue'
import Main from '../components/qianyemian/Main.vue'
import Showye from '../components/qianyemian/Showye.vue'
import Ceshi from '../components/qianyemian/Ceshi.vue'
import Server1 from '../components/qianyemian/Server.vue'
import Suggest from '../components/qianyemian/Suggest.vue'
import UserLogin from '../components/qianyemian/UserLogin.vue'
import Userregister from '../components/qianyemian/Userregister.vue'
import Hotalreserve from '../components/qianyemian/Hotalreserve.vue'
import RoomreservationManagement from '../components/guest/RoomreservationManagement.vue'
import YdzrzManagement from '../components/guest/YdzrzManagement.vue'
import RoomchangeManagement from '../components/guest/RoomchangeManagement.vue'
import SettleaccountsManagement from '../components/guest/SettleaccountsManagement.vue'
import RoomManagement from '../components/guest/RoomManagement.vue'
import CommodityManagement from '../components/basic/CommodityManagement.vue'
import SuggestManagement from '../components/basic/SuggestManagement.vue'
import SanitationManagement from '../components/basic/SanitationManagement.vue'
import ItemsadoptManagement from '../components/basic/ItemsadoptManagement.vue'

import Customerservice from '../components/Customerservice.vue'


Vue.use(VueRouter)

const routes = [
  {path:'/',redirect:'/main'},
  {path : '/login' , component : Login},
  {path : '/ceshi' , component : Ceshi},
  {path : '/main' , component : Main ,
    redirect : '/shouye',
    children : [
      {path : '/shouye' , component : Showye},
      {path : '/server' , component : Server1},
      {path : '/suggest' , component : Suggest},
      {path : '/userLogin' , component : UserLogin},
      {path : '/userregister' , component : Userregister},
      {path : '/hotalreserve' , component : Hotalreserve},
      {path : '/hotalreserve' , component : Hotalreserve},
      {path : '/customerservice' , component : Customerservice},
    ]
  },
  {path : '/home' , component : Home , 
  redirect : '/welcome',
   children : [
    {path : '/welcome' , component : Welcome}, //主页面 曲面折线图
    { path: '/users', component: Users },   //暂时不用
    { path: '/userManagement', component: UserManagement },   //用户管理
    { path: '/hotelPersomManagement', component: HotelPersomManagement },   //酒店人员权限管理
    { path: '/roomreservationManagement', component: RoomreservationManagement },   //客房预订管理
    { path: '/ydzrzManagement', component: YdzrzManagement },   //预定转入住管理
    { path: '/roomchangeManagement', component: RoomchangeManagement },   //换房管理
    { path: '/settleaccountsManagement', component: SettleaccountsManagement },   //换房管理
    { path: '/roomManagement', component: RoomManagement },   //客房管理
    { path: '/commodityManagement', component: CommodityManagement },   //商品管理
    { path: '/suggestManagement', component: SuggestManagement },   //建议管理
    { path: '/sanitationManagement', component: SanitationManagement },   //酒店卫生管理
    { path: '/itemsadoptManagement', component: ItemsadoptManagement },   //酒店物品采纳
    {path : '/customerservice1' , component : Customerservice},
  ]}
]

const router = new VueRouter({
  routes
})

//挂载路由导航守卫
// router.beforeEach((to,from,next)=>{
//   // console.info(to.path)
//   //to访问的路径
//   if(to.path === '/login') return next();
//   // //获取token
//   const tokenStr = window.sessionStorage.getItem('token')
//   if(!tokenStr) return next('/login')
//   next()
// })

export default router
